<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">

<head>
  <%@include file="/view/common/head.jsp"%>
  <link rel="stylesheet" href="static/css/login.css">
  <title>登录页面</title>
</head>

<body>
  <div class="content">
    <p class="welcome">
      欢迎登录
    </p>
    <div class="login_content">
      <p>登录尚硅谷用户</p>
      <div class="msg_count">
        <b></b>
        <span>
<%--            <%=request.getAttribute("msg")==null?"请输入用户名和密码":request.getAttribute("msg")%>--%>
          ${empty requestScope.msg ? "请输入用户名和密码" : requestScope.msg}
          </span>
      </div>
      <form action="userServlet" method="POST">
        <input type="hidden" name="action" value="login" readonly>
        <div>
          <label for="username">用户名称：</label>
          <input type="text" id="username" name="username"
                 placeholder="请输入用户名"
                 value="${requestScope.username}">
        </div>

        <div>
          <label for="password">用户密码：</label>
          <input type="password" id="password" name="password" placeholder="请输入密码">
        </div>
        <div style="position: relative">
          <label for="code">&nbsp;验&nbsp;证&nbsp;码：
            <input type="text" id="code" name="code" placeholder="" style="width: 100px">
          </label>
            <img id="img_code" src="kaptcha.img" alt="验证码" style="width: 30%; height: 40px; position: absolute; right: 30px">
        </div>
        <button type="submit">登录</button>
        <a href="view/user/register.jsp" style="color: red">马上注册</a>
      </form>
    </div>
  </div>
  <%@include file="/view/common/footer.jsp"%>

  <script>
    $(function () {
      $("#img_code").click(function () {
        this.src = "${basePath}kaptcha.img?d=" + new Date();
      })
    })
  </script>
</body>

</html>